<?php
$this->pageTitle=Yii::app()->name . ' - Responder Questionário';
$this->breadcrumbs=array(
	'Responder Questionário',
        $questionario->nome . ' (Versão '.  number_format($questionario->versao,1).')',
);

Yii::app()->getClientScript()->registerScriptFile(Yii::app()->baseUrl . '/js/jquery.price_format.1.7.js');
Yii::app()->clientScript->registerScript('jquery_priceformat',"
    $('input[id*=_faturamento_empresa]').priceFormat({
        prefix:'',
        centsSeparator:',',
        thousandsSeparator:'',
        clearPrefix:true,
    });
");
?>

<h1>Responder Questionário</h1>

<p><strong>Questionário: </strong><?php echo $questionario->nome; ?> (Versão <?php echo number_format($questionario->versao, 1); ?>)<br /><strong>Descrição: </strong><?php echo $questionario->descricao; ?></p>

<div class="form">
    
    <?php $form = $this->beginWidget('CActiveForm',array(
        'id'=>'responder-form',
        'enableClientValidation'=>true,
        'clientOptions'=>array(
            'validationOnSubmit'=>true,
        ),
    )); ?>
    
    <p style="font-size: 13pt; margin-bottom: 10px;"><strong>Informações Gerais</strong></p>
        
    <div class="row span-5">
        <?php echo $form->labelEx($model,'num_funcionario'); ?>
        <?php echo $form->textField($model,'num_funcionario'); ?>
        <?php echo $form->error($model,'num_funcionario'); ?>
    </div>

    <div class="row span-5">
        <?php echo $form->labelEx($model,'faturamento_empresa'); ?>
        <?php echo $form->textField($model,'faturamento_empresa'); ?>
        <?php echo $form->error($model,'faturamento_empresa'); ?>
    </div>
            
    <div class="clear"></div>
    <?php $numQuest = 1; ?>
    <?php foreach($questoes as $questao): ?>

        <div class="view">
            <p style="font-size:13pt; margin-bottom:10px;"><strong><?php echo $numQuest.') ';  echo $questao->descricao_questao; ?></strong></p>
            <?php echo $form->radioButtonList($resposta,'['.$questao->id_questao.']id_alternativa',CHtml::listData(Alternativa::model()->findAll('id_questao = :id_questao',array(':id_questao'=>$questao->id_questao)),'id_alternativa','texto'),array('separator'=>'<div class="clearfix"></div>','style'=>'display: inline; float: left;')); ?>
            <br /><?php echo $form->error($resposta,'['.$questao->id_questao.']id_alternativa'); ?>
        </div>
    
        <?php $numQuest++; ?>
    
    <?php endforeach; ?>
    
    <?php echo CHtml::submitButton('Gravar Respostas'); ?>
    
    <?php $this->endWidget(); ?>
    
</div>

